#ifndef __LIB_TUXPAINT_SOUND_H__
#define __LIB_TUXPAINT_SOUND_H__
#define RECORDED_SOUNDS_SIZE 100

// SAMPLE: this type will be used to hold one audio sample.
typedef float SAMPLE;

// recording: this struct is used to store a sound recorded with this library.
typedef struct
{	
	int size;
	int x;
	int y;
	// This variable shows if the sound is being recorded or if it's been recorded.
	int finished;
	SAMPLE *samples;
} tp_sound_recording;

extern tp_sound_recording* recorded_sounds[RECORDED_SOUNDS_SIZE];
extern int free_recorded_sound_index;

/* initializes tux paint sound */
void tp_sound_initialize(void);

/* initializes tux paint sound */
void tp_sound_terminate(void);

/* get_recording returns the sound stored in the position 'n', if it doesn't exist then it returns null */ 
tp_sound_recording* tp_sound_get_recording(int n);

/* put_recording is used to store a sound in the recorded_sounds array */
int tp_sound_put_recording(tp_sound_recording*);

/* recorded_sounds_full is used to see if the recorded_sounds array has indexes available or not */
int tp_sound_recorded_sounds_full(void);

/* recorded_next_slot is used to retrieve the next free slot */
int tp_sound_next_slot(void);

/* recording_in_coordinates returns the recording in the square of side 2*offset and center x,y. If there is no recording, it returns a null pointer. 
  for example tp_sound_coordinates_recorded(10,20,5) will return a recording if there is one with x between 5 and 16 and y between 15 and 25 pixels.
*/
tp_sound_recording* tp_sound_recording_in_coordinates(int x, int y, int offset);
#endif

